package com.zxt.recruit.util;

import org.springframework.stereotype.Component;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

@Component
public class CurrentDateUtil {
    /**
     * 生成一个日期生成方法
     * @return formattedDateTime=>2023-10-17 14:53:30
     * yyyy-MM-dd HH:mm:ss
     */

    public LocalDate currentDate(){
        LocalDate currentDate = LocalDate.now();
        return currentDate;
    }
    public LocalDateTime currentDateTime(){
        LocalDateTime currentDateTime = LocalDateTime.now();
        return currentDateTime;
    }
    public String formatter(){
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
        LocalDateTime currentDateTime = LocalDateTime.now();
        String formattedDateTime = currentDateTime.format(formatter);
        return formattedDateTime;
    }
    public String formatterDate(){
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDateTime currentDateTime = LocalDateTime.now();
        String formattedDateTime = currentDateTime.format(formatter);
        return formattedDateTime;
    }


}
